<%@ taglib uri="/WEB-INF/struts-html.tld"  prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld"  prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-nested.tld"  prefix="nested"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld"  prefix="bean"%>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.forecast.commons.SessionKeys,
                 com.scalar.forecast.commons.Constants"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<chiptrack:checkLogon sourcePage="/forecastSetup.do"/>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<% User user1 = (User) session.getAttribute (SessionKeys.USER_KEY); %>
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<META content="Microsoft FrontPage 5.0" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">

<SCRIPT src="<%=chipTracContext%>/jsp/includes/scripts/functions.js">
</SCRIPT>

<SCRIPT language=JavaScript src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</SCRIPT>

<SCRIPT language=JavaScript>



</SCRIPT>
<SCRIPT language=JavaScript>
function openLevelSetup()
{
    newWindow = window.open ('level_setup.htm','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=500,height=450,resizable=no,left=325,top=180');
    newWindow.focus();
}
function userDefinedField()
{
    newWindow = window.open ('<%=chipTracContext%>/forecastUserDefinedFields.do','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=550,height=250,resizable=no,left=325,top=250');
    newWindow.focus();
}
var levelCnt = 0; //number of levels initially present.
var entryFieldsCnt=0; //total number of entryfields.
var qtyIdx = 0; //index of the Forecast Entry Field 'Qty' checkbox. it is used to enable checkbox while submitting.
var priceIdx = 0; //index of the Forecast Entry Field 'Price' checkbox. it is used to enable checkbox while submitting.
function addNewLevel( rowId )
{

    var form = document.forecastSetupForm;
    enableFields ( );
    form.action="forecastSetup.do?action=addNewLevel";
    form.submit();

	/*var row = document.getElementById(rowId);
    var table = row.parentElement;
    var newRow = table.insertRow(row.rowIndex);
    var td = newRow.insertCell();
	td.width = "18";
	td.innerHTML="&nbsp;";

	td = newRow.insertCell();
	td.width = "8";
	td.innerHTML="&nbsp;";

	td = newRow.insertCell();
	td.width = "211";
	td.innerHTML="<INPUT type=checkbox name='levels[" + levelCnt + "].selected' value='ON' onClick='enableDisableLevels(this," + levelCnt + ")'>&nbsp;<FONT  class=NArialL><input type='text' class='txfield' size='25' name='levels[" + levelCnt + "].levelName' DISABLED maxlength="100"></FONT>";



	td = newRow.insertCell();
	td.width = "86";
	td.align = "center";
	td.innerHTML='<FONT class=NArialL><input type="text" class="txfield" size="6" name="levels[' + levelCnt + '].levelOrder"  DISABLED></FONT>';

	td = newRow.insertCell();
	td.width = "57";
	td.innerHTML="&nbsp;";

	td = newRow.insertCell();
	td.width = "261";
	td.innerHTML="&nbsp;";

	levelCnt = levelCnt + 1; */

}
function enableDisableLevels( chkbox, levelRowCnt ) //levelRowCnt starts from zero
{
	var form = document.forecastSetupForm;
	if ( chkbox.checked )
	{
		form['levels[' + levelRowCnt + '].levelName'].disabled = false;
		form['levels[' + levelRowCnt + '].levelOrder'].disabled = false;

		form['levels[' + levelRowCnt + '].levelName'].focus();
	}
	else
	{
		form['levels[' + levelRowCnt + '].levelName'].disabled = true;
		form['levels[' + levelRowCnt + '].levelOrder'].disabled = true;
	}
}
function enableFields ( )
{
   var form = document.forecastSetupForm;
   form.byProduct.disabled = false;
   form['forecastEntryFields[' + qtyIdx + '].entrySelected'].disabled = false;
   form['forecastEntryFields[' + priceIdx + '].entrySelected'].disabled = false;
   for ( i =0 ; i < levelCnt; i++ )
   {
        form['levels[' + i + '].levelName'].disabled = false;
        form['levels[' + i + '].levelOrder'].disabled = false;
   }
}
function sortit(a,b) //don't modify this method , as this method is used to sort an array numerically.
{
    return(a-b)
}

function isValidLevels()
{
    var form = document.forecastSetupForm;
    var levelOrderArray = new Array();
    var levelOrderArrayCnt = 0;
    for ( i =0 ; i < levelCnt; i++ )
    {
        if ( form['levels[' + i + '].selected'].checked )
        {
            var levelName  =  form['levels[' + i + '].levelName'];
            var levelOrder =  form['levels[' + i + '].levelOrder'];
            if ( levelName.value.trim() == '' )
            {
                errors = errors + "<li>Please enter Level Name</li>"
                levelName.select();
                return false;
            }
            if( levelOrder.value != '')
            {
                if(!isInteger(levelOrder.value))
                {
                    errors = errors +"<li>  Please enter a valid Level Order ";
                    levelOrder.select();
                    return false;
                }
                else if( levelOrder.value == 0 )
                {
                    errors = errors +"<li>  Please enter a valid Level Order ";
                    levelOrder.select();
                    return false;
                }
            }
            else
            {
                errors = errors + "<li>  Please enter the Level Order";
                levelOrder.select();
                return false;
            }
            levelOrderArray[levelOrderArrayCnt] = parseInt ( levelOrder.value );
            levelOrderArrayCnt++;
        }
    }
    levelOrderArray.sort ( sortit );
    if ( levelOrderArrayCnt == 0 )
    {
        errors = errors + "<li>Please select atleast One Level</li>"
        return false;
    }
    else if ( levelOrderArrayCnt == 1 )
    {
        if ( levelOrderArray[0] != 1 )
        {
            errors = errors + "<li>The selected Level Order should be '1'.</li>"
            return false;
        }
    }
    else if ( levelOrderArray[0] != 1 )
    {
        errors = errors + "<li>The Level Order should start from '1'.</li>"
        return false;
    }
    else
    {
        //checking duplicates
        for ( i=0; i < ( levelOrderArrayCnt - 1 ); i++ )
        {
            currentValue = parseInt ( levelOrderArray[i] );
            nextValue = parseInt ( levelOrderArray[i+1] );
            if ( currentValue == nextValue )
            {
                errors = errors + "<li>Level Order can not be duplicated</li>"
                return false;
            }
        }
        //checking any level order is missing
        for ( i=0; i < ( levelOrderArrayCnt - 1 ); i++ )
        {
            currentValue = parseInt ( levelOrderArray[i] );
            nextValue = parseInt ( levelOrderArray[i+1] );
            if ( ( currentValue + 1 ) != nextValue )
            {
                errors = errors + "<li>Level Order '" + ( currentValue + 1 ) + "' is Missing</li>"
                return false;
            }
        }
    }
    return true;
}
function isValidFreezingPoint()
{
    var form = document.forecastSetupForm;
    var tfCompany = form.tfCompany;
    if( tfCompany.value != '')
    {
        if(!isInteger(tfCompany.value))
        {
            errors = errors +"<li>  Please enter a valid Freezing Point";
            tfCompany.select();
            return false;
        }
        else if( tfCompany.value == 0 )
        {
            errors = errors +"<li>  Please enter a valid Freezing Point";
            tfCompany.select();
            return false;
        }
    }
    else
    {
        errors = errors + "<li>  Please enter Freezing Point";
        tfCompany.select();
        return false;
    }

    var tfName = form.tfName;
    var measureType = form.tfMeasureType.value;
    var tfNameValue = "";
    var tfCompanyValue = parseInt ( tfCompany.value );
    for ( i=0; i < tfName.length; i++ )
    {
        if ( tfName[i].checked==true )
            tfNameValue = tfName[i].value.trim();
    }
    if ( tfNameValue == 'Month' )
    {
        if ( measureType.toUpperCase() == 'DAYS' )
        {
           if ( parseInt ( tfCompanyValue ) > 30 )
           {
                errors = errors + "<li> Freezing point can't be greater than 30</li>"
                tfCompany.select();
                return false;
           }
        }
        if ( measureType.toUpperCase() == 'WEEKS' )
        {
            if ( parseInt ( tfCompanyValue ) > 4 )
            {
                errors = errors + "<li> Freezing point can't be greater than 4</li>"
                tfCompany.select();
                return false;
            }
        }
        if ( measureType.toUpperCase() == 'MONTHS' )
        {
            errors = errors + "<li> Freezing point can't be in Months for Timeframe By Month</li>"
            //tfCompany.select();
            return false;
       }
    }
    else if ( tfNameValue == 'Quarter' )
    {
        if ( measureType.toUpperCase() == 'DAYS' )
        {
           if ( parseInt ( tfCompanyValue ) > 90 )
           {
                errors = errors + "<li> Freezing point can't be greater than 90</li>"
                tfCompany.select();
                return false;
           }
        }
        if ( measureType.toUpperCase() == 'WEEKS' )
        {
            if ( parseInt ( tfCompanyValue ) > 12 )
            {
                errors = errors + "<li> Freezing point can't be greater than 12</li>"
                tfCompany.select();
                return false;
            }
        }
        if ( measureType.toUpperCase() == 'MONTHS' )
        {
            if ( parseInt ( tfCompanyValue ) > 3 )
            {
                errors = errors + "<li> Freezing point can't be greater than 3</li>"
                tfCompany.select();
                return false;
            }
       }
    }
    else if ( tfNameValue == 'Year' )
    {
        if ( measureType.toUpperCase() == 'DAYS' )
        {
           if ( parseInt ( tfCompanyValue ) > 360 )
           {
                errors = errors + "<li> Freezing point can't be greater than 360</li>"
                tfCompany.select();
                return false;
           }
        }
        if ( measureType.toUpperCase() == 'WEEKS' )
        {
            if ( parseInt ( tfCompanyValue ) > 52 )
            {
                errors = errors + "<li> Freezing point can't be greater than 52</li>"
                tfCompany.select();
                return false;
            }
        }
        if ( measureType.toUpperCase() == 'MONTHS' )
        {
            if ( parseInt ( tfCompanyValue ) > 12 )
            {
                errors = errors + "<li> Freezing point can't be greater than 12</li>"
                tfCompany.select();
                return false;
            }
       }
    }
    return true;
}
function isValidEntrySetup()
{
    var form = document.forecastSetupForm;
    if ( form.byProject.checked )
    {
        if ( ! form.byCustomer.checked )
        {
            errors = errors + "<li>By Customer should be selected if By Project is selected</li>"
            return false;
        }
    }
    if ( form.byOdm.checked )
    {
        if ( ! form.byCustomer.checked )
        {

            errors = errors + "<li>By Customer should be selected if By  <bean:message key="label.sales.endCustomer"/> is selected</li>"
            return false;
        }
    }
    return true;
}
var errors = "";
function onSubmit( actionName )
{
    var form = document.forecastSetupForm;
    if ( actionName == 'reloadForecastEntryFields' )
    {
        enableFields();
        form.action="forecastSetup.do?action=" + actionName;
        form.submit();
        return;
    }
    errors = "";
    var pa  = document.getElementById ( 'errorsId' );
    pa.innerHTML = "";
    if ( !isValidEntrySetup() )
    {
        pa.innerHTML = errors;
        return;
    }
    if ( !isValidFreezingPoint() )
    {
        pa.innerHTML = errors;
        return;
    }
    if ( isLevelNameDuplicatesPresent ( ) )
    {
        pa.innerHTML = '<li>Level Name can not be duplicated</li>'
        return;
    }
    if ( !isValidLevels() )
    {
        pa.innerHTML = errors;
        return;
    }

    if ( actionName == null || typeof actionName == 'undefined' )
    {
        form.action="forecastSetup.do?action=new"
    }
    else
    {
        form.action="forecastSetup.do?action=" + actionName;
    }
    enableFields();
    form.submit();
}
function onReset()
{
    var form = document.forecastSetupForm;
    form.reset();
    for ( i =0 ; i < levelCnt; i++ )
    {
        if ( form['levels[' + i + '].selected'].checked )
        {
            form['levels[' + i + '].levelName'].disabled = false;
		    form['levels[' + i+ '].levelOrder'].disabled = false;
        }
        else
        {
            form['levels[' + i + '].levelName'].disabled = true;
		    form['levels[' + i + '].levelOrder'].disabled = true;
        }
    }
}

function isLevelNameDuplicatesPresent ( )
{
	var form = document.forecastSetupForm;
    for ( i =0; i< levelCnt; i++ )
    {
        var cnt = 0;
		if ( form['levels[' + i + '].selected'].checked )
		{
		    var level1 =  trim ( form['levels[' + i + '].levelName'].value )
		   if ( level1 != '' )
		   {
				for ( j=0; j< levelCnt; j++ )
				{
					if ( form['levels[' + j + '].selected'].checked )
					{
						var level2= trim ( form['levels[' + j + '].levelName'].value )
						if ( level1.toUpperCase() == level2.toUpperCase() )
						{
							cnt = cnt + 1;
						}
						if ( cnt > 1 )
						{
							form['levels[' + i + '].levelName'].select();
							form['levels[' + i + '].levelName'].focus();
							return true;
						}
					}
				}
			}
		}
    }
    return false;
}
</SCRIPT>

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<INPUT type=hidden name=action>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD vAlign=top width=180 background=<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif>
    <!-- Side Navigation start -->
      <%@ include file="/jsp/marketing/marketing_menu.jsp" %>
    <!-- end of the side navigations --></TD>
    <TD bgColor=#ffffff><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"
      width=8></TD>
    <TD bgColor=#ffffff><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"
      width=2></TD>
    <TD vAlign=top width="100%"><IMG height=1
      src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0> <BR>
      <CENTER><SPAN class=NArialW>Forecast Setup</SPAN></CENTER><IMG height=20
      src="<%=chipTracContext%>/jsp/includes/images/spacer.gif">
      <TABLE cellSpacing=0 cellPadding=0 width="98%" align=center border=0>
        <TBODY>
        <TR>
          <TD>
            <TABLE cellSpacing=0 cellPadding=0 width="98%" align=center border=0>
              <TBODY>
              <TR>
                <TD>
<html:form action="/forecastSetup" name="forecastSetupForm" type="com.scalar.forecast.forecastSetup.forms.ForecastSetupForm" scope="session">

                  <TABLE cellSpacing=0 cellPadding=0 width="621" align=center
                  border=0>
                    <TBODY>
                    <TR><TD colspan='5' id='errorMessagesId'><chiptrack:errors styleClass='NArialL' /></TD></TR>
                    <TR><TD colspan='5' id='infoMessagesId'><chiptrack:info styleClass='NArialL' /> </TD></TR>
                    <TR><TD colspan='5' class="NArialL"><FONT id="errorsId"  color='FF0000'></FONT></TD></TR>
                    <% if ( !user1.isActionAllowed ( Functionality.FORECAST_SETUP,User.USER_ACTION_MODIFY ) )
                        {
                    %>
                        <tr><td colspan=5 align='left'><font class='NArialS'><font color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font></td></tr>
                    <%  } %>
                    <TR> <TD colSpan=5 width="621">&nbsp;</TD></TR>
                    <TR>
                      <TD align=left bgColor=#993333 colSpan=5 width="621"  height="16"><FONT
                        class=NArialL><FONT color=#ffffff>&nbsp;Forecast Entry Setup
                        </FONT></FONT></TD></TR>
                    <TR> <TD colSpan=5 width="621">&nbsp;</TD></TR>
                    <TR>
                      <TD width="27">&nbsp;</TD>
                      <TD width="484">
                      <html:checkbox property="byProduct" value="true" disabled="true"/>
                    <FONT class=NArialL>By Product</FONT></TD>
                      <TD width="36">&nbsp;</TD>
                      <TD width="37">&nbsp;</TD>
                      <TD width="37">&nbsp;</TD></TR>
                    <TR>
                      <TD width="27">&nbsp;</TD>
                      <TD width="484">
                      <html:checkbox property="byCustomer" value="true"/>
                      <FONT class=NArialL>By Customer</FONT></TD>
                      <TD width="36">&nbsp;</TD>
                      <TD width="37">&nbsp;</TD>
                      <TD width="37">&nbsp;</TD></TR>

                    <TR>
                      <TD width="27">&nbsp;</TD>
                      <TD width="484">
                      <html:checkbox property="byProject" value="true"/>
                      <FONT class=NArialL>By Project</FONT></TD>
                      <TD width="36">&nbsp;</TD>
                      <TD width="37">&nbsp;</TD>
                      <TD width="37">&nbsp;</TD></TR>
                     <TR>
                      <TD width="27">&nbsp;</TD>
                      <TD width="484">
                      <html:checkbox property="byOdm" value="true"/>
                      <%--<INPUT type=checkbox name=ByODM value="ON">--%>
                    <FONT class=NArialL>By <bean:message key="label.sales.endCustomer"/></FONT></TD>
                      <TD width="36">&nbsp;</TD>
                      <TD width="37">&nbsp;</TD>
                      <TD width="37">&nbsp;</TD></TR>
                 </TBODY></TABLE></TD></TR>

              <TR>
                <TD>&nbsp;</TD></TR>
              <TR>
                <TD>&nbsp;</TD></TR>
              <TR>
                <TD>
                  <TABLE cellSpacing=0 cellPadding=0 width="629" align=center
                  border=0>
                    <TBODY>
                    <TR>
                      <TD align=left bgColor=#993333 colSpan=6 width="621"  height="16"><FONT
                        class=NArialL><FONT color=#ffffff>&nbsp;Timeframe Setup
                        </FONT></FONT></TD></TR>
                    <TR>
                      <TD colSpan=6 width="621">&nbsp;</TD>
					</TR>
                    <TR>
                      <TD width="27">&nbsp;</TD>
                      <TD width="106">
                        <html:radio property="tfName" value="Month"/>
                        <FONT class=NArialL>By Month</FONT></TD>
                       <TD width="100">
                        <html:radio property="tfName" value="Quarter"/>
                        <FONT class=NArialL>By Quarter</FONT></TD>
					   <TD width="115">
                        <html:radio property="tfName" value="Year"/>
                        <FONT class=NArialL>By Year</FONT></TD>
                       <TD width="247" nowrap><FONT class=NArialL>Freezing
                        Point:&nbsp;</FONT>
                        <html:text property="tfCompany" size="5" styleClass="txfield" onkeypress="javascript:allowInteger()" maxlength="3"/>
                        &nbsp; <html:select property="tfMeasureType" styleClass="txfield" >
                                    <html:option value="Days">Days</html:option>
                                    <html:option value="Weeks">Weeks</html:option>
                                    <html:option value="Months">Months</html:option>
                                </html:select>
                        </TD>
					 </TR>

				  	</TBODY></TABLE></TD></TR>
              <TR>
                <TD>&nbsp;</TD></TR>
              <TR>
                <TD>&nbsp;</TD></TR>
              <TR>
                <TD>
                  <TABLE cellSpacing=1 cellPadding=0 width="629" align=center
                  border=0>
                    <TBODY>
                    <TR>
                      <TD align=left bgColor=#993333 colSpan=6 width="621"  height="16"><FONT
                        class=NArialL><FONT color=#ffffff>&nbsp;Level Setup
                        </FONT></FONT></TD></TR>
                    <TR>
                      <TD colSpan=6 width="621">&nbsp;</TD></TR>
                    <TR>
                      <TD width="18">&nbsp;</TD>
                      <TD width="9">&nbsp;</TD>
                      <TD width="191" align="center" bgColor="#DEE1E2"><font class="NArialL"> Level Name</font></TD>
                      <TD width="86" align="center" bgColor="#DEE1E2"><font class="NArialL"> Level Order</font></TD>
                      <TD width="57">&nbsp;</TD>
                      <TD width="261">&nbsp;</TD></TR>
                   <% int levelCnt=0; %>
                   <nested:root name="forecastSetupForm">
                   <nested:iterate name="forecastSetupForm" property="levels" indexId="idx"  id="levelBean" type="com.scalar.forecast.forecastSetup.LevelBean">
                    <% levelCnt++; %>
                    <TR>
                      <TD width="18">&nbsp;</TD>
                      <TD width="9">&nbsp;</TD>
                      <nested:hidden name="levelBean" property="levelId"/>
                      <TD width="211" nowrap>
                        <% String onClickEvent = "enableDisableLevels( this," + idx.intValue() + ")"; %>
                         <nested:checkbox name="levelBean" property="selected" value="ON" onclick="<%= onClickEvent%>"/>
                    <FONT class=NArialL>
                        <nested:equal name="levelBean" property="selected" value="true">
                            <nested:text name="levelBean" property="levelName" styleClass="txfield" size="25" maxlength="100"/>
                        </nested:equal>
                        <nested:notEqual name="levelBean" property="selected" value="true">
                            <nested:text name="levelBean" property="levelName" styleClass="txfield" size="25" disabled="true" maxlength="100"/>
                        </nested:notEqual>
                    </FONT></TD>
                      <TD width="86" align="center">
                    <FONT class=NArialL>
                       <nested:equal name="levelBean" property="selected" value="true">
                        <nested:text name="levelBean" property="levelOrder" styleClass="txfield" size="6" onkeypress="javascript:allowInteger()" maxlength="3"/>
                       </nested:equal>

                       <nested:notEqual name="levelBean" property="selected" value="true">
                        <nested:text name="levelBean" property="levelOrder" styleClass="txfield" size="6"  onkeypress="javascript:allowInteger()" disabled="true" maxlength="3"/>
                       </nested:notEqual>

                    </FONT></TD>
                      <TD width="57">&nbsp;</TD>
                      <TD width="261">&nbsp;</TD>
                    </TR>
                  </nested:iterate>
                  </nested:root>
                  <script>levelCnt=<%=levelCnt%>;</script>

                    <TR id="newRowId">
                      <TD width="18">&nbsp;</TD>
                      <TD width="8">&nbsp;</TD>
                      <TD width="191">&nbsp;</TD>
                      <TD width="86">&nbsp;</TD>
                      <TD width="57">&nbsp;</TD>
                      <TD align=right width="261">&nbsp;</TD></TR>
                    <TR>
                      <TD width="18">&nbsp;</TD>
                      <TD width="8">&nbsp;</TD>
                      <TD width="191"><FONT class=NArialL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></TD>
                      <TD width="86" align="right"><A href="javascript:addNewLevel('newRowId');"><IMG
                        onmouseover="window.status='Click here to Add Level';return true"
                        title="Click here to Add Level"
                        onmouseout="window.status='';return true"
                        src="<%=chipTracContext%>/jsp/includes/images/addmore.gif"
                    border=0></A></TD>
                      <TD width="57">&nbsp;</TD>
                      <TD align=right width="261">&nbsp;</TD></TR></TBODY></TABLE></TD></TR>
              <TR>
                <TD>&nbsp;</TD></TR>

			  <!-------------------------------------------------------------->
			  <TR>
                <TD>
                  <TABLE cellSpacing=0 cellPadding=0 width="629" align=center
                  border=0>
                    <TBODY>
                    <TR>
                      <TD align=left bgColor=#993333 colSpan=6 width="621"  height="16"><FONT
                        class=NArialL><FONT color=#ffffff>&nbsp;Forecast Entry Fields
                        </FONT></FONT></TD></TR>
                    <TR>
                      <TD colSpan=6 width="621">&nbsp;</TD></TR>
                 <% int entryFieldsCnt = 0;%>
              <nested:iterate property="forecastEntryFields" indexId="idx" id="entryFields">
                    <% entryFieldsCnt++; %>
                    <TR>
                      <TD width="19">&nbsp;</TD>
                      <TD width="10">&nbsp;</TD>
                      <TD width="516">
                      <nested:hidden property="rowId"/>
                      <nested:equal property="entryName" value="Qty">
                        <script>qtyIdx=<%=idx%>;</script>
                        <nested:checkbox property="entrySelected" value="ON" disabled="true" />
                      </nested:equal>
                      <nested:equal property="entryName" value="Price">
                        <script>priceIdx=<%=idx%>;</script>
                        <nested:checkbox property="entrySelected" value="ON" disabled="true" />
                      </nested:equal>
                      <nested:notEqual property="entryName" value="Qty">
                        <nested:notEqual property="entryName" value="Price">
                            <nested:checkbox property="entrySelected" value="ON" />
                        </nested:notEqual>
                      </nested:notEqual>
                     <FONT class=NArialL><nested:write property="entryName"/><%--Quantity--%></FONT></TD>
                      <TD width="26">&nbsp;</TD>
                      <TD width="26">&nbsp;</TD>
                      <TD width="27">&nbsp;</TD></TR>
                </nested:iterate>
                <script>entryFieldsCnt = <%=entryFieldsCnt%>;</script>

                    <TR>
                      <TD width="18">&nbsp;</TD></TR>
                    <TR>
                      <TD width="18">&nbsp;</TD>
                      <TD width="8">&nbsp;</TD>

                      <TD align=left width="516"><FONT class=NArialL>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A class=link
                        onmouseover="window.status='Click to add User Defined Fields';return true"
                        onmouseout="window.status='';return true"
						title="Click to add User Defined Fields"
                        href="javascript:userDefinedField();">User Defined Fields</A></FONT></TD>
					  <TD width="26">&nbsp;</TD>
                      <TD width="26">&nbsp;</TD>
                      <TD width="27">&nbsp;</TD>
					</TR>
				</TBODY>
				</TABLE>
			</TD>
		</TR>
			  <!-------------------------------------------------------------->

		  <TR>
			<TD>
			  <TABLE cellSpacing=0 cellPadding=0 width="80%" align=center border=0>
				<TBODY>
				<TR><TD>&nbsp;</TD></TR>
				<TR>
				  <TD align=middle>
                      <chiptrack:restrictedLink functionality='<%=Functionality.FORECAST_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:onSubmit('save');" onmouseover="window.status='Click to Save Forecast Setup Information';return true" onmouseout="window.status='';return true">
                      <IMG onmouseover="window.status='Click to Save Forecast Setup Information';return true" title="Click to Save Forecast Setup Information" 	onmouseout="window.status='';return true" height=17 src="<%=chipTracContext%>/jsp/includes/images/save.gif" width=53 border=0></chiptrack:restrictedLink>&nbsp;&nbsp;&nbsp;&nbsp;
                      <A href="javascript:onReset();"><IMG onmouseover="window.status='Click to Reset';return true" title="Click here to Reset" onmouseout="window.status='';return true" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border=0 width="53" height="17"></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  </TD>
                </TR>
                </TBODY>
              </TABLE>
            </TD>
          </TR>
		  <TR>
			<TD>&nbsp;</TD></TR>
		  <TR>
			<TD>&nbsp;</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR><BR><BR></TD>
    <TD bgColor=#ffffff><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif"
      width=1></TD></TR>
</html:form>
<!-- Footer starts here -->

<%@ include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->
</BODY>
</HTML>